﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:CharacterCreation.Controls">

    <Style TargetType="{x:Type controls:StatisticControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:StatisticControl}">
                    <StackPanel Orientation="Horizontal" Height="28">

                        <StackPanel.Resources>
                            <Style TargetType="TextBlock">
                                <Setter Property="Width" Value="90" />
                                <Setter Property="Margin" Value="5,5,5,0" />
                            </Style>

                            <Style TargetType="TextBox">
                                <Setter Property="Margin" Value="5,5,5,0" />
                                <Setter Property="HorizontalContentAlignment" Value="Center" />
                                <Setter Property="VerticalContentAlignment" Value="Center" />
                            </Style>

                            <controls:StatisticModeVisibilityConverter x:Key="v" />
                        </StackPanel.Resources>

                        <TextBlock Text="{Binding Statistic.Name}" Foreground="{TemplateBinding Foreground}" IsEnabled="{TemplateBinding IsEnabled}" />
                        <TextBox Width="40" Text="{Binding StartingValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{TemplateBinding DisplayMode, Converter={StaticResource v}, ConverterParameter=StartingValue}"/>
                        <TextBox Width="40" Text="{Binding RacialBonus, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{TemplateBinding DisplayMode, Converter={StaticResource v}, ConverterParameter=RacialBonus}"/>
                        <TextBox Width="40" Text="{Binding RacialXP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{TemplateBinding DisplayMode, Converter={StaticResource v}, ConverterParameter=RacialXP}"/>
                        <TextBox Width="40" Text="{Binding ProfessionalXP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{TemplateBinding DisplayMode, Converter={StaticResource v}, ConverterParameter=ProfessionalXP}"/>
                        <TextBox Width="40" Text="{Binding XP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{TemplateBinding DisplayMode, Converter={StaticResource v}, ConverterParameter=XP}"/>
                        <TextBox Width="40" Text="{Binding MiscellaneousXP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{TemplateBinding DisplayMode, Converter={StaticResource v}, ConverterParameter=MiscellaneousXP}"/>
                        <TextBox Width="40" Text="{Binding TotalXP, Mode=OneWay}" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{TemplateBinding DisplayMode, Converter={StaticResource v}, ConverterParameter=TotalXP}"/>
                        <TextBox Width="40" Text="{Binding Score, Mode=OneWay}" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{TemplateBinding DisplayMode, Converter={StaticResource v}, ConverterParameter=Score}"/>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>
